package com.zkw.ss.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

/**
 * Created by Administrator on 2016/5/3 0003.
 * annotation形式配置servlet
 */
@WebServlet(name = "an",urlPatterns = {"/CalendarServlet","/annot"})
public class Anno extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=UTF-8");
        PrintWriter out=resp.getWriter();
        // Write some content
        out.println("<html>");
        out.println("<head>");
        out.println("<title>CalendarServlet</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h2>Hello </h2>");
        out.println("<h2>The time right now is : " + new Date() + "</h2>");
        out.println("</body>");
        out.println("</html>");
        out.close();
    }
}
